<!-- Copyright (c) 2022 渝州大数据实验室
 *
 * Lanius is licensed under Mulan PSL v2.
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of Mulan PSL v2 at:
 *
 *     http://license.coscl.org.cn/MulanPSL2
 *
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PSL v2 for more details.
 -->
<!-- 
* @desc:组织管理搜索组件
* @fileName:organization-search.vue
* @author:zhouyongjie@yzbdl.ac.cn
* @date:2022-4-6
!-->
<script setup lang="ts">
import { ref } from "vue";
//引入切图
import { Plus, Search } from "@element-plus/icons-vue";
const props = defineProps({
  // 查询方法
  searchFunc: Function as any,
  //新增方法
  addNewFunc: Function as any,
});

// 定义用户昵称值
const organizationValue = ref("");

//判断右侧弹窗显隐

const showdrawer = ref(false);

/**
 * @description:点击查询按钮
 * @return void
 */
const serarch = () => {
  // 组装查询参数
  let serachData = {
    organizationValue: organizationValue.value,
  };
  // 调用父组件传递的方法进行查询
  props.searchFunc(serachData);
};

/**
 * @description:点击新增按钮
 * @return void
 */
const addNew = () => {
  showdrawer.value = true;
  props.addNewFunc(showdrawer.value);
};
</script>

<template>
  <div class="page-search">
    <!-- 列表文字 -->
    <div class="page-title-words">组织管理</div>
    <el-input
      v-model="organizationValue"
      placeholder="请输入组织名称"
      class="search-input"
      clearable
      :suffix-icon="Search"
      @clear="serarch"
      @keyup.enter.native="serarch"
    />
    <el-button @click="addNew" class="add">
      <el-icon class="icon">
        <plus />
      </el-icon>
      新增</el-button
    >
  </div>
</template>

<style lang="scss" scoped>
.page-search {
  display: flex;
  justify-content: flex-end;
  .page-title-words {
    font-size: 16px;
    color: #000;
    flex: 1;
  }
  .el-input {
    padding-right: 10px;
    :deep(.el-input__wrapper) {
      height: 30px;
      border-radius: 0;
      background-color: #f2f2f6 !important;
      box-shadow: unset !important;
    }
    :deep(.el-input__suffix) {
      right: 18px;
    }
  }
  .search-input {
    width: 160px;
    margin-right: 10px;
  }
  .icon {
    margin-right: 10px;
  }
  .el-button {
    width: 70px;
    height: 30px;
    border-radius: 0;
    background-color: #f2f2f6;
    color: #000;
    border: 0;
  }
  .el-button:hover {
    width: 70px;
    height: 30px;
    border-radius: 0;
    background-color: #5473e6;
    color: #fff;
  }
}
</style>
